//headers 
#include<algorithm>
#include<cassert>
#include<cstdio>
#include<deque>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<deque>
#include<set>
#include<string>
#include<sstream>
#include<stack>
#include<streambuf>
#include<vector>
using namespace std;

//macros
#define LET(x,a) typeof(a) x(a)
#define FOR(i,a,n) for(LET(i,a);i!=n;i++)
#define REP(i,n) FOR(i,0,n)
#define sz size()
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define dbge(x) cout<<#x<<"->"<<x<<endl;
#define PRINT(x) REP(_,x.sz) cout<<x[_]<<" "; cout<<endl;
#define OUT(x) x<<" "
const int INF = (int) 1e8;
#define VI vector<int>
#define VS vector<string>
#define VVI vector< vector<int> >
#define LL long long

//code of suren

VVI grid;
VI colored;
int poss;

void bicolor(int node, int color){
  if(!poss) return;
  REP(i,grid[node].sz){
    int newnode = grid[node][i];
    if(colored[newnode]==-1) { colored[newnode]=!color; bicolor(newnode,!color); }
    else if(colored[newnode]==color) { poss=0; break; }
  }
  return ;
}

int main(){
  int n,l; 
  while(cin>>n && n ){
    grid.clear(); grid.resize(n);
    colored.clear(); colored.resize(n,-1);
    cin>>l; int i,j;
    REP(k,l) { cin>>i>>j; grid[i].pb(j); grid[j].pb(i); }
    //    REP(i,grid.sz) { PRINT(grid[i]); cout<<endl; }
    poss = 1;
    colored[0]=1;
    bicolor(0,1);
    if(poss) cout<<"BICOLORABLE."<<endl;
    else cout<<"NOT BICOLORABLE."<<endl;
  }
  
  return 0;
}
